package com.vhly.superrecoder;

import android.app.Activity;
import android.content.Context;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.widget.CheckBox;
import android.widget.CompoundButton;

/**
 * Created by IntelliJ IDEA.
 * User: vhly[FR]
 * Date: 2010-11-26
 * Time: 20:52:05
 * Email: vhly@163.com
 */
public final class SettingActivity extends Activity implements CompoundButton.OnCheckedChangeListener {
    private SharedPreferences preferences;
    private boolean bSilent;

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.setting);
        CheckBox chkSilent = (CheckBox) findViewById(R.id.chksilent);
        chkSilent.setOnCheckedChangeListener(this);
        preferences = getSharedPreferences("SRSettings",Context.MODE_WORLD_WRITEABLE);
    }

    public void onCheckedChanged(CompoundButton compoundButton, boolean b) {
        System.out.println("b = " + b);   // 830059037000
        bSilent = b;
        SharedPreferences.Editor editor = preferences.edit();
        editor.putBoolean("silent",bSilent);
        editor.commit();
    }
}
